<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta charset="UTF-8">
    <title>Axios</title>
</head>
<body>
<div id="app">

        <input type="text" v-model="username">
        <input type="text" v-model="pd">
        <input type="button" value="获取" @click="GetS">


    <span>{{password}}</span>

</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            username: null,
            password: null,
            pd: null
        },
        methods: {
            GetS:function() {
                var that=this;
                axios.post('http://localhost:8082/user/login',this.username).then(
                    function(response) {
                        var mima=response.data;
                        if(mima==that.pd)
                        {
                            alert(that.pd)
                            that.password=mima;
                        }
                    },function(error) {
                    }
                )
            }
        }
    });
</script>
</body>
</html>
